<!-- app/View/Users/add.ctp -->
<?php
echo $this->element('headerPageTitle', array("titlePage" => "Usuarios", "subTitlePage" => "Añadir Nuevo"));
?>
<div class="page secondary">
<div class="page-region">
    <div class="page-region-content">
        <div class="grid">
            <div class="row">
                <div class="span12">
                    <?php echo $this->Session->flash('usuario'); ?>
                </div>
            </div>
            <div class="row">
                <div class="span6">
                    <div class="hero-unit border-color-blue">
                        <h2>Rellena los datos</h2>
                    <?php echo $this->Form->create('User'); ?>
                        <div class="input-control span5 text">
                            <?php echo $this->Form->input('username', array('label' => 'Nombre de usuario','autocomplete'=>'off','placeholder' => 'Introduzca el usuario'));?>
                        </div>
                        <div class="input-control span5 password">
                            <?php echo $this->Form->input('password', array('label' => 'Contraseña','autocomplete'=>'off','placeholder' => 'Contraseña')); ?>
                        </div>

                        <div class="input-control span5 password">

                        <?php echo $this->Form->input('role', array('label' => 'Rol de Usuario',
                            'options' => array('admin' => 'Admin', 'cafeytelasrozas' => 'cafeytelasrozas')
                        ));
                        ?>
                        </div>
                    <?php echo $this->Form->end(__('Grabar')); ?>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="span8 offset1">

                        <h2>Listado de Usuarios</h2>
                    <table class="bordered striped">
                        <tr>
                            <th>Id</th>
                            <th>UserName</th>
                        </tr>
                        <!-- Here's where we loop through our $posts array, printing out users info -->
                        <?php foreach ($users as $user): ?>
                        <tr>
                            <td><?php echo $user['User']['id']; ?></td>
                            <td>
                                <?php echo $this->Html->link($user['User']['username'], array('action' => 'view', $user['User']['id']));?>
                            </td>
                            <td>
                                <?php echo $this->Form->postLink(
                                'Borrar',
                                array('action' => 'delete', $user['User']['id']),
                                array('confirm' => '¿Estás seguro?'));
                                ?>
                            </td>

                        </tr>
                        <?php endforeach; ?>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>
</div>